{% extends "base.html" %}  <!-- 继承主模板 -->

{% block content %}

<div class="row">
    <!-- 左侧留言区（占9列） -->
    <form class="col-md-9" action="{{ url_for('blog.post_comment') }}" method="post" style="margin-left: 30px">
        <h1>留言板</h1>
        <div class="form-group">
            <label for="nickname">昵称</label>
           <input id="nickname" name="nickname" placeholder="请输入昵称" class="form-control">
        </div>

        <div class="form-group">
            <label for="content">留言</label>
            <textarea id="content" name="content" class="form-control"  placeholder="请输入留言..." style="height: 100px"></textarea>
        </div>
        <button type="submit" class="btn btn-primary btn-block">发布留言</button>
    </form>
</div>
<div class="container mt-4">
    <h3 class="mb-4">最新评论</h3>
    <div class="row">
        {% for comment in comments %}
            <div class="media mb-4 p-3 shadow-sm rounded border col-md-8 row" style="background-color: #f9f9f9; width: 650px;margin-left: 30px">
                <div class="media-body">
                    <h5 class="mt-0 text-primary">{{ comment.nickname }}</h5>
                    <p style="margin-bottom: 5px;">{{ comment.content }}</p>
                    {% if comment.create_time %}
                        <small class="text-muted">发表于 {{ comment.create_time.strftime('%Y-%m-%d %H:%M') }}</small>
                    {% endif %}
                </div>
            </div>
        {% endfor %}
    </div>
</div>

{% endblock %}
